#!/bin/sh
TFILE="/media/testdrive/result.txt"
#Esperamos hasta que se haya completado el arranque
while ! test -f /var/run/runlevel; do
	sleep 1
done

echo "----- STARTING TEST -----"
echo " EXECUTING TEST IN `pwd`" > $TFILE
# Esperamos que la red haya arrancado

echo "Network status: " >> $FILE
netstat -an >> $TFILE
echo 
echo "Repository index file: " >> $FILE
wget http://localhost:9000/ -O - >> $TFILE 2>&1

#Setting the version of packagemanager to zero (forcing update)
echo "00000000" > /var/pkg/installed/pkgmanager
#Launching update...
if /usr/local/opendomo/updateInstalledPackages.sh; then
	echo "OK" >> $TFILE
else
	echo "FAILED" >> $TFILE
fi

echo "--------------------------------------------------------------------TEST ENDED" 

reboot
